import { lazy } from "react";
import App from "../App";
import {createBrowserRouter} from 'react-router-dom'
const Home=lazy(()=>import('../page/home/Index'))
const Login=lazy(()=>import('../page/login/Index'))
const Order=lazy(()=>import('../page/order/Index'))
const Set=lazy(()=>import('../page/set/Index'))
const Detail=lazy(()=>import('../page/detail/Index'))
const Menu=lazy(()=>import('../page/set/menu/Index'))
export const houserouters=[
  {
    path:'/home/order',
    element:<Order></Order>,
    title:'订单'
  },
  {
    path:'/home/set',
    element:<Set></Set>,
    title:'设置',
    children:[
      {
        path:'/home/set/menu',
        element:<Menu></Menu>,
        title:'菜单'
      }
    ]
  }
]
const routes=createBrowserRouter([
   {
    path:'/',
    element:<App></App>,
    children:[
      {
        index:true,
        element:<Home></Home>
      },
      {
        path:'/home',
        element:<Home></Home>,
        children:houserouters
      }
    ]
   },
   {
    path:'/login',
    element:<Login></Login>
   },
   {
    path:'/detail',
    element:<Detail></Detail>
   }
])
export default routes